package com.bean;

/**
 * 微信请求状态数据
 *
 * @author LiYi
 */
public class BaseResult {

    private static final String SUCCESS_CODE = "0";

    private boolean success;
    private String errcode;
    private String errmsg;

    public BaseResult(){}

    public BaseResult(boolean success, String errcode, String errmsg) {
        this(success, errmsg);
        this.errcode = errcode;

    }

    public BaseResult(boolean success, String errmsg) {
        this.success = success;
        this.errmsg = errmsg;
    }

    public String getErrcode() {
        return errcode;
    }

    public void setErrcode(String errcode) {
        this.errcode = errcode;
    }

    public String getErrmsg() {
        return errmsg;
    }

    public void setErrmsg(String errmsg) {
        this.errmsg = errmsg;
    }

    public boolean isSuccess() {
        return errcode == null || errcode.isEmpty() || errcode.equals(SUCCESS_CODE);
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    @Override
    public String toString() {
        return "BaseResult{" + "errcode='" + errcode + '\'' + ", errmsg='" + errmsg + '\'' + '}';
    }
}
